<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2024-06-18
  Time: 17:06
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
    <style>
        table{border: 1px black solid;border-collapse: collapse }
        td{border: 1px black solid}
        #tixing{
            color: red;
        }
    </style>
<body>

<form action="/test2/add" method="post" onsubmit="return b()">
    <h2>添加电影信息</h2>
    <table>
        <tr>
            <td>电影名称</td>
            <td>  <input type="text" name="name" style="border: 1px solid black" id="name"></td>
        </tr>
        <tr>
            <td>主演</td>
            <td> <input type="text" style="border: 1px solid black" name="actor" id="actor"></td>
        </tr>
        <tr>
            <td> 导演</td>
            <td><input type="text" style="border: 1px solid black" name="dirctor" id="dirctor"></td>
        </tr>
        <tr>
            <td>时长</td>
            <td><input type="text" style="border: 1px solid black" name="movie_time" id="time" oninput="value=value.replace(/[^\d]/g,'')"></td>
        </tr>
        <tr>
            <td>类型名称</td>
            <td><select style="margin-left: 50px" name="type" id="type">
                <option value="0" disabled="disabled" label="请选择" selected>请选择</option>
                <option value="1">喜剧</option>
                <option value="2">动作</option>
                <option value="3">科幻</option>
            </select></td>
        </tr>
        <tr>
            <td colspan="2"><input type="submit" value="提交" style="margin-left: 80px" ></td>
        </tr>

    </table>
    <p id="tixing">${msg}</p>

</form>
<script>
    function b(){
        var rex=""
        var a=document.getElementById('name').value
        var b=document.getElementById('actor').value
        var c=document.getElementById('dirctor').value
        var d=document.getElementById('time').value
        var e=document.getElementById('type').value
        if (a==""){
            alert("名字为空")
            return false
        }
        if (b==""){
            alert("演员为空")
            return false
        }
        if (c==""){
            alert("导演为空")
            return false
        }
        if (d==""){
            alert("时长为空")
            return false
        }
        if (e=="0"){
            alert("未选择类型")
            return false
        }
        return true
    }
    var tixing=document.getElementById("tixing")
    setInterval(function (){
        tixing.style.display="none";
    },4000)

</script>
</body>
</html>
